﻿using System;
using Kaiser.Models;
using Kaiser.Modules.Hiner.Models.Consignee.SearchModels;
using Kaiser.Modules.Hiner.Repositories;
using Kaiser.Modules.Hiner.Services;

namespace Kaiser.Modules.Hiner.Models.Consignee
{
    public class Consignee : IConsigneeService
    {
        private readonly IConsigneeRepositorie _repository;

         public Consignee(IConsigneeRepositorie repository)
        {
            _repository = repository;//
        }



        public DataGrid<ConsigneeBase> SearchConsignee(ConsigneeSearch search, Kaiser.Models.PagingInfo pageinfo)
        {
            try
            {
                return _repository.SearchConsignee(search, pageinfo);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }

        public void Insert(ConsigneeBase model)
        {
            try
            {
                _repository.Insert(model);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }

        public void Update(ConsigneeBase model)
        {
            try
            {
                _repository.Update(model);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }

       public  ConsigneeBase  Get(object primaryId)
        {
            try
            {
               return _repository.Get(primaryId);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }


        public int Delete(object primaryId)
        {
            try
            {
              return  _repository.Delete(primaryId);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }


        public int DeleteList(System.Collections.Generic.IList<string> ids)
        {
            throw new NotImplementedException();
        }
    }
}
